<%--
  Created by IntelliJ IDEA.
  User: CY
  Date: 2017/12/25
  Time: 14:12
  To change this template use File | Settings | File Templates.
--%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8 ? MYOA_CHARSET : htmlspecialchars($HTML_PAGE_CHARSET))?>" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" type="text/css" href="../../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/base.css"/>
    <link rel="stylesheet" type="text/css" href="../lib/pagination/style/pagination.css"/>
    <%--<link rel="stylesheet" href="/css/officialDocument/officialDocument.css">--%>
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" type="text/css" href="/css/patrol/patrol.css"/>
    <link rel="stylesheet" type="text/css" href="../lib/laydate.css"/>
    <%--<script src="../js/jquery/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>--%>
    <script src="/lib/jQuery-File-Upload-master/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../lib/layer/layer.js?20201106"></script>
    <script src="../lib/laydate/laydate.js"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>
    <script src="../lib/ueditor/ueditor.config.js" type="text/javascript" charset="utf-8"></script>
    <script src="../lib/ueditor/ueditor.all.js" type="text/javascript" charset="utf-8"></script>


    <style>
        .edui-default .edui-editor{
            width:100%!important;
        }
        .edui-default .edui-editor-breadcrumb span{
            height:20px!important;
            line-height: 20px;
            background: #fff;
        }
        #edui1_iframeholder{
            height:120px!important;
        }
            #edui1_bottombar{
                display: none;
            }
        input{
            color:#333!important;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="mainBg" style="padding-top:0px;">
            <form action="" id="datasave">
                <input type="file" onchange="filesTwo(this)" id="picFile"  multiple="multiple" name="file" style="display: none">
                <%--<input type="file"  id="uploadinputimg"  multiple="multiple" name="file" style="display: none">--%>
                <div class="mainTitle" style="padding:20px 10px 0px;border-bottom:none">
                    <ul class="mainTitleUl">
                        <li style="    padding-top: 18px;text-align: center;height: 61px;border-bottom: 1px solid #ddd"><span class="spanSize">信息报送单</span> </li>
                        <li class="bordercolor clearfix" style="display: none;">
                            <span style="border-bottom: 1px solid #fff;">是否采集</span>
                            <label style="width: 80%;">
                                <input type="radio" name="iscollection" style="width:20px;line-height: 57px;margin: 10px 0px 0px 28px;" value="1">
                                <label style="width:30px;line-height: 57px;font-size:16px;">是</label>
                                <input type="radio" name="iscollection"  style="width:20px;line-height: 57px;margin-top: 10px;" value="1">
                                <label style="width:30px;line-height: 57px;font-size:16px;">否</label>
                            </label>
                        </li>
                        <li class="bordercolor clearfix">
                            <span style="border-bottom: 1px solid #fff;">标题</span>
                            <label style="width: 80%;">
                                <input type="text" name="title" placeholder="标题" style="background: #fcfcfc;    width: 92%;
    float: none;
    margin-top: 10px;">

                            </label>
                        </li>
                        <li class="bordercolor clearfix">
                            <span style="border-bottom: 1px solid #fff;">填报部门</span>
                            <label style="width: 30%;">
                                <input type="text" name="" id="dept" placeholder="请填写填报部门" style="background: #fcfcfc;    width: 78%;
    float: none;
    margin-top: 10px;" >
                                <input type="hidden" name="deptId">
                            </label>
                            <span style="border-bottom: 1px solid #fff;">填报人</span>
                            <label style="width: 30%;">
                                <input type="text" name="" id="user" placeholder="请填写填报人" style="background: #fcfcfc;    width: 78%;
    float: none;
    margin-top: 10px;" >
                                <input type="hidden" name="userId">
                            </label>
                        </li>
                        <li class="bordercolor clearfix">
                            <span style="border-bottom: 1px solid #fff;">审核方式</span>
                            <label style="width: 80%;">
                                <input type="radio" name="managerType" style="width:20px;line-height: 57px;margin: 17px 0px 0px 28px;float:left" value="0">
                                <label style="width:111px;line-height: 57px;font-size:16px;">线上内部审核</label>
                                <input type="radio" name="managerType"  style="width:20px;line-height: 57px;margin-top: 17px;float:left" value="1">
                                <label style="width:150px;line-height: 57px;font-size:16px;">线下审核，直接报送</label>
                            </label>
                        </li>
                        <li class="bordercolor clearfix">
                            <span style="border-bottom: 1px solid #fff;height: 64px;line-height: 64px">审核人</span>
                            <label style="width: 80%;height: 64px;">
                                <input type="text" name="" id="shen" placeholder="请填写审核人" style="background: #fcfcfc;    width: 70%;
    float: left;
    margin-top: 10px;margin-left:28px;" >
                                <a href="javascript:;" class="select" style="float:left;color:#2F8AE3">选择</a>
                                <a href="javascript:;" class="empty" style="float:left;margin-left:10px;color:#2F8AE3">清空</a>
                                <input type="hidden" name="managerId">
                            </label>
                        </li>
                        <li class="bordercolor clearfix">
                            <span style="border-bottom: 1px solid #fff;">填报时间</span>
                            <label style="width: 30%;">
                                <input type="text" name="createTime" placeholder="请填写填报时间" style="background: #fcfcfc;    width: 78%;
    float: none;
    margin-top: 10px;" >

                            </label>
                            <span style="border-bottom: 1px solid #fff;">联系电话</span>
                            <label style="width: 30%;">
                                <input type="text" name="phone" placeholder="请填写联系电话" style="background: #fcfcfc;    width: 78%;
    float: none;
    margin-top: 10px;" >

                            </label>
                        </li>
                        <li class="bordercolor clearfix">
                            <span style="border-bottom: 1px solid #fff;">报送给</span>
                            <label style="width: 80%;text-align: left">
                                <textarea name="" id="users" deptId="" style="width:200px;height:50px;margin-top: 4px;margin-left: 33px;;"></textarea>
                                <a href="javascript:;" class="addUser">添加</a>
                                <a href="javascript:;" class="delUser">清空</a>
                                <%--<input type="checkbox" class="check" name="" style="width:20px;line-height: 57px;margin: 18px 0px 0px 28px;float:left" value="34">--%>
                                <%--<label style="width:87px;line-height: 57px;font-size:16px;">督查信息科</label>--%>
                                <%--<input type="checkbox" class="check" name=""  style="width:20px;line-height: 57px;margin-top: 18px;float:left" value="41">--%>
                                <%--<label style="width:61px;line-height: 57px;font-size:16px;">宣传部</label>--%>
                                <%--<input type="checkbox" class="check" name=""  style="width:20px;line-height: 57px;margin-top: 18px;float:left" value="20">--%>
                                <%--<label style="width:48px;line-height: 57px;font-size:16px;">文明办</label>--%>
                                <input type="hidden" name="deliveryDeptId">
                            </label>
                        </li>

                        <li class="bordercolor clearfix">
                            <span style="border-bottom: 1px solid #fff;height: 100px;line-height: 100px">图片上传</span>
                            <label style="width: 80%;height: 100px;">
                                <div class="picture prevTwo" style="position: relative">
                                    <input type="hidden" name="attachmentId2">
                                    <%--<a class="fl addPhotos" href="javascript:void (0)" ></a>--%>
                                    <img class="fl addPhotos" style="    width: 60px;cursor: pointer;
    height: 60px;
    margin-top: 4px;
    margin-right: 7px;" src="/img/grid/addtupin.png" alt="添加照片">
                                    <%--<input type="file" multiple="multiple" name="file" onchange="filesTwo(this)"  style="position: absolute;opacity: 0;width: 60px;cursor:pointer;height:60px;left:5px;--%>
<%--filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0)">--%>
                                    <input type="hidden" name="attachmentName2">
                                    <ul class="fl">
                                        <%--<li>--%>
                                        <%--<img src="/img/app/email.png" alt="">--%>
                                        <%--<b class="deleClear">x</b>--%>
                                        <%--</li>--%>
                                    </ul>

                                    <%--style="display:none;position: absolute;width: 68px;height: 30px;top: 27px;right: 5px;"--%>

                                </div>
                            </label>
                        </li>

                        <li class="bordercolor clearfix">
                            <span style="border-bottom: 1px solid #fff;" id="con">内容</span>
                            <label style="width: 80%;" id="conLabel">
                                <div id="container" name="context"  type="text/plain" style="width: 94%;min-height: 100px;margin:0 auto;"></div>
                                <%--<input type="hidden" name="context">--%>
                                <input type="hidden" name="attachmentId">
                                <input type="hidden" name="attachmentName">
                                <input type="hidden" name="publish">
                            </label>
                        </li>

                    </ul>

                </div>
            </form>

                <div class="mainTitle" style="padding:0 10px;border-top:none">
                    <form id="uploadimgform" target="uploadiframe"  action="../upload?module=infomation" enctype="multipart/form-data" method="post">
                        <input type="file" multiple="multiple" name="file" id="uploadinputimg"  class="w-icon5" style="position: absolute;opacity: 0;width: 70px;cursor:pointer;
                        filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0)">
                        <ul class="mainTitleUl">
                            <li class="bordercolor clearfix">
                                <span style="border-bottom: 1px solid #fff;height: 64px;line-height: 64px">附件</span>
                                <label style="width: 80%;height: 64px;text-align: left;font-size:16px;border-bottom:none;line-height: 20px;">

                                    <a id="uploadimg" style="cursor: pointer;color:#2F8AE3;padding-left:20px;float:left;line-height: 57px;">附件上传</a>
                                    <div id="query_uploadArr" style="display: block;float:left">
                                    </div>
                                </label>
                            </li>
                        </ul>
                    </form>
                </div>

            <div style="height: 50px;line-height: 50px;text-align: center">
                <a href="javascript:void (0)" data="1"  class="preservation" style="
                margin-top: 25px;display: inline-block;margin-right: 10px;
                line-height: 1;font-size:18px;padding: 8px 20px;
                background: #2F8AE3;color: #fff;border-radius: 6px">转交</a>
                <a href="javascript:void (0)" data="0" class="preservation" style="
                margin-top: 25px;display: inline-block;margin-right: 10px;
                line-height: 1;font-size:18px;padding: 8px 20px;
                background: #2F8AE3;color: #fff;border-radius: 6px">保存</a>
                <a href="javascript:void (0)" class="getBack"  style="
                margin-top: 25px;display: inline-block;
                line-height: 1;font-size:18px;padding: 8px 20px;background: #2F8AE3;color: #fff;border-radius: 6px" >返回</a>
            </div>
        </div>
    </div>
    </div>
    <script>
        var param=$.GetRequest();
        var user_id;

        $('.addUser').click(function () {
                user_id='users';
                $.popWindow("../common/selectUser");

        });
        $('.delUser').click(function () {
            $('#users').val("");
            $('#users').attr("username","")
            $('#users').attr("dataid","")
            $('#users').attr("user_id","")
            $('#users').attr("userprivname","")
        })
        $(document).on('click','.delDept',function () {
            $('#deptName').val('');
            $('#deptName').attr('deptid','');
            $('#deptName').attr('deptname','');
            $('#deptName').attr('privid','');
            $('#deptName').attr('userpriv','');
            $('#deptName').attr('username','');
            $('#deptName').attr('dataid','');
            $('#deptName').attr('userprivname','');
        })

        if(param.type){
            $('.getBack').click(function(){
                $('#conList',window.parent.document).show();
                $('#info',window.parent.document).hide();
                $('#add',window.parent.document).show();
            })
        }else{
            $('.getBack').click(function(){
                window.history.go(-1)
            })
        }
        if(param.dataType==2){
            $('.preservation').hide();
            $('input[name="createTime"]').attr('readonly','readonly')
            noUser();
            var id=param.id;
            $.ajax({
                url:'/infomation/getInformationDetail',
                type:'get',
                data:{id:id},
                dataType:'json',
                success:function(res){
                    var data=res.object;
                    var time=new Date(data.createTime).Format('yyyy-MM-dd hh:mm:ss')
//                    console.log(time)
                    $('input[name="title"]').val(data.title);//标题
                    if(data.managerType==0){
                        $('input[name="managerType"]').eq(0).attr('checked','checked');
                    }else{
                        $('input[name="managerType"]').eq(1).attr('checked','checked');
                    }
                   $('#shen').val(data.managerName);//审核人
                    $('input[name="managerId"]').val(data.managerId); //审核人userid\
                    $('#shen').attr('user_id',data.managerId)
                    $('input[name="createTime"]').val(time);//时间
                    $('#user').val(data.userName);
                    $('input[name="userId"]').val(data.userId);
                    $('#dept').val(data.deptName);
                    $('input[name="deptId"]').val(data.deptId)
                    if(data.deliveryDeptId!=""){
                        $('input[name="deliveryDeptId"]').val(data.deliveryDeptId)
                        $('#users').val(data.deliveryDeptName)
                        $('#users').attr('user_id',data.deliveryDeptId)
                        $('#users').attr('username',data.deliveryDeptName)
                        // var arr=data.deliveryDeptId.split(',');
                        // for(var i=0;i<arr.length;i++){
                        //     if(arr[i]==34){
                        //         $('.check').eq(0).attr('checked','checked');
                        //     }else if(arr[i]==41){
                        //         $('.check').eq(1).attr('checked','checked');
                        //     }else if(arr[i]==20){
                        //         $('.check').eq(2).attr('checked','checked');
                        //     }
                        // }
                    }//报送部门
                    $('input[name="createTime"]').val(time);//时间
                    $('input[name="phone"]').val(data.phone);//时间
//                    图片显示
                    var obj=data.imgattachments;
                    var str1=""
                    for(var i=0;i<obj.length;i++){
                        str1+='<li>' +
                            '<img src="/xs?'+obj[i].attUrl+'" alt="" onclick="javascript:window.open(this.src)" style="cursor:pointer">' +
//                            '<b class="deleClear">x</b>' +
                            '<input type="hidden" class="imgId" value="'+obj[i].aid+'@'+obj[i].ym+'_'+obj[i].attachId+'">' +//id
                            '<input type="hidden" class="imgName" name="attachmentNametwo" value="'+obj[i].attachName+'">' +//名字
                            '</li>'
                    }
                    $('.prevTwo>ul').html(str1);
                    $('input[name="attachmentId2"]').val(data.attachmentId2)
                    $('input[name="attachmentName2"]').val(data.attachmentName2)
                    var ue = UE.getEditor('container');

                    ue.addListener("ready", function () {
                        ue.setContent(data.context);
                    });
//                    附件
                    var arr=data.attachmentList;
                    var str2=""
                    for(var i=0;i<arr.length;i++){
                        str2 += '<div class="font_ dech" deUrl="'+arr[i].attUrl+'" style="display:block;"><a href="<%=basePath%>download?' + arr[i].attUrl + '"><img style="width:16px;" src="../img/file/cabinet@.png"/>' + arr[i].attachName + '</a><img class="deImgs" style="margin-left:5px;cursor: pointer;" src="../img/file/icon_deletecha_03.png"/>'+
                            '<input type="hidden" class="inHidden" NAME="'+arr[i].attachName+'*" value="'+arr[i].aid+'@'+arr[i].ym+'_'+arr[i].attachId+',"></div>';
                    }
                    $('#query_uploadArr').append(str2);
                }
            })
        }else if(param.dataType==1){
            var id=param.id;
            $('input[name="createTime"]').attr('readnly','readonly')
            $.ajax({
                url:'/infomation/getInformationDetail',
                type:'get',
                data:{id:id},
                dataType:'json',
                success:function(res){

                    var data=res.object;

                    var time=new Date(data.createTime).Format('yyyy-MM-dd hh:mm:ss')
//                    console.log(time)
                    $('input[name="title"]').val(data.title);//标题
                    if(data.managerType==0){
                        $('input[name="managerType"]').eq(0).attr('checked','checked');
                    }else{
                        $('input[name="managerType"]').eq(1).attr('checked','checked');
                    }
                    $('#shen').val(data.managerName);//审核人
                    $('input[name="managerId"]').val(data.managerId); //审核人userid
                    $('#shen').attr('user_id',data.managerId)
                    $('input[name="createTime"]').val(time);//时间
                    $('#user').val(data.userName);
                    $('input[name="userId"]').val(data.userId);
                    $('#dept').val(data.deptName);
                    $('input[name="deptId"]').val(data.deptId)
                    if(data.deliveryDeptId!=""){
                        $('input[name="deliveryDeptId"]').val(data.deliveryDeptId)
                        $('#users').val(data.deliveryDeptName)
                        $('#users').attr('user_id',data.deliveryDeptId)
                        $('#users').attr('username',data.deliveryDeptName)
                        // var arr=data.deliveryDeptId.split(',');
                        // for(var i=0;i<arr.length;i++){
                        //     if(arr[i]==34){
                        //         $('.check').eq(0).attr('checked','checked');
                        //     }else if(arr[i]==41){
                        //         $('.check').eq(1).attr('checked','checked');
                        //     }else if(arr[i]==20){
                        //         $('.check').eq(2).attr('checked','checked');
                        //     }
                        // }
                    }//报送部门
                    $('input[name="createTime"]').val(time);//时间
                    $('input[name="phone"]').val(data.phone);//时间
                    //                    图片显示
                    var obj=data.imgattachments;
                    var str1=""
                    for(var i=0;i<obj.length;i++){
                        str1+='<li ">' +
                            '<img src="/xs?'+obj[i].attUrl+'" alt="" onclick="javascript:window.open(this.src)" style="cursor:pointer">' +
                            '<b class="deleClear">x</b>' +
                            '<input type="hidden" class="imgId"  value="'+obj[i].aid+'@'+obj[i].ym+'_'+obj[i].attachId+'">' +//id
                            '<input type="hidden"  class="imgName" value="'+obj[i].attachName+'">' +//名字
                            '</li>'
//
                    }
                    $('.prevTwo>ul').html(str1);
                    $('input[name="attachmentId2"]').val(data.attachmentId2)
                    $('input[name="attachmentName2"]').val(data.attachmentName2)
                    var ue = UE.getEditor('container');
                    ue.addListener("ready", function () {
                        ue.setContent(data.context);
                    });//内容

//                    附件
                    var arr=data.attachmentList;
                    var str2=""
                    for(var i=0;i<arr.length;i++){
                        str2 += '<div class="font_ dech" deUrl="'+arr[i].attUrl+'" style="display:block;"><a href="<%=basePath%>download?' + arr[i].attUrl + '"><img style="width:16px;" src="../img/file/cabinet@.png"/>' + arr[i].attachName + '</a><img class="deImgs" style="margin-left:5px;cursor: pointer;" src="../img/file/icon_deletecha_03.png"/>'+
                            '<input type="hidden" class="inHidden" NAME="'+arr[i].attachName+'*" value="'+arr[i].aid+'@'+arr[i].ym+'_'+arr[i].attachId+',"></div>';
                    }
                    $('#query_uploadArr').append(str2);
                    $('input[name="attachmentId"]').val(data.attachmentId);
                    $('input[name="attachmentName]').val(data.attachmentName);
                }
            })
        }else if(param.dataType==0){
            $.ajax({
                url:'/infomation/getUsersInfo',
                type:'get',
                dataType:'json',
                success:function(res){
                    var data=res.object;
                    $('#dept').val(data.deptName)
                    $('#user').val(data.userName);
                    $('input[name="deptId"]').val(data.deptId+',')
                    $('input[name="userId"]').val(data.userId+',')
                    $('input[name="createTime"]').val(data.createTime)
                }
            })
        }
        //        获取ue编辑器
        var ue = UE.getEditor('container');


        //        初始化禁用
        $('#dept').attr('disabled','disabled')
        $('#user').attr('disabled','disabled')
        $('input[name="createTime"]').attr('readonly','readonly')

//        禁用
        function noUser(){
            $('input[name="title"]').attr('disabled','disabled');
            $('#dept').attr('disabled','disabled');
            $('#user').attr('disabled','disabled');
            $('#shen').attr('disabled','disabled');
            $('input[name="phone"]').attr('disabled','disabled');
            $('.addPhotos').hide();
            var ue = UE.getEditor('container');
            ue.addListener("ready", function () {
                ue.setDisabled();
            });
        }

        //        设置ue 的高度
        function height(){
            var ueH=$('#container').height();
//            console.log(ueH)
//            console.log($('#edui2').height())
            $('#conLabel').height(ueH+150);
            $('#con').height(ueH+150)
            $('#con').css('line-height',(ueH+150)+'px');
        }
        height();
        $(window).resize(function() {
            $('#edui1_bottombar').show();
            var ueH=$('#container').height();
//            console.log(ueH)
            $('#conLabel').height(ueH);
            $('#con').height(ueH)
            $('#con').css('line-height',(ueH)+'px');
        });



//                if(param.read){
//                    $.ajax({
//                        url:'/infomation/updateState',
//                        type:'post',
//                        data:{isread:param.read,id:param.id},
//                        dataType:'json',
//                        success:function(res){
//                            if(res.flag){
//
//                            }
//                        }
//                    })
//                }
        $('.preservation').click(function(){
            var me=$(this)
            if(param.dataType==0){ //新建
                $('#datasave').prop('action','/infomation/insertInfo');
                var con=""
                var ue = UE.getEditor('container');
                ue.addListener("ready", function () {
                    con=ue.getContent();
                });
                $('input[name="context"]').val(con.replace(',',""));//内容
                if(me.attr('data')=='0'){
                    $('input[name="publish"]').val('0');//未转交
                }else{
                    $('input[name="publish"]').val('1');//转交
                }
                var fileId="";
                var fileName="";
                for(var i=0;i<$('.inHidden').length;i++){
                    fileId += $('.inHidden').eq(i).val();
                    fileName += $('.inHidden').eq(i).attr('name');
                }
                var imgId="";
                var imgName=""
                for(var i=0;i<$('.imgId').length;i++){
                    imgId += $('.imgId').eq(i).val()+','
                }
                for(var i=0;i<$('.imgName').length;i++){
                    imgName += $('.imgName').val()+'*'
                }
                $('input[name="attachmentId2"]').val(imgId);
                $('input[name="attachmentName2"]').val(imgName);

                $('input[name="managerId"]').val($('#shen').attr('user_id'))//审核人
                $('input[name="managerType"]:checked').val();
                $('input[name="attachmentId"]').val(fileId) //附加id
                $('input[name="attachmentName"]').val(fileName) //附件内容
//                var timer=$('input[name="createTime"]').val()
//                $('input[name="createTime"]').val(new Date(Date.parse(timer.replace(/-/g, "/"))).getTime()/1000)
//                 var len=$('.check').length;
//                 var str=""
//                 for(var i=0;i<len;i++){
//                     if($('.check').eq(i).is(':checked')){
//                         str += $('.check').eq(i).attr('value')+',';
//                     }
//                 }
                $('input[name="deliveryDeptId"]').val($('#users').attr('user_id'))
                $('#datasave').ajaxSubmit({
                    type:'post',
                    dataType:'json',
                    success:function(res){
                        if(res.flag){
                            $.layerMsg({content:'新建成功',icon:1});
                            if(param.read){
                                if(param.is==0){
//                                    parent.getPage();
//                                    parent.document.getElementById('iframe').src="/infomation/unread"
                                }else{
//                                    parent.getPage1();
//                                    parent.document.getElementById('iframe').src="/infomation/allInfo"
                                }
                            }else{
                                parent.ajaxPageLe.page();
                                $('.iframe',window.parent.document).hide();
                                $('#conList',window.parent.document).show();
                                $('#add',window.parent.document).show();
                            }

                        }
                    }
                })
            }else if(param.dataType==1){ //修改
                $('#datasave').prop('action','/infomation/editInformation');
                var id=param.id;

                var con=""
                var ue = UE.getEditor('container');
                ue.addListener("ready", function () {
                    con=ue.getContent();
                });

                $('input[name="context"]').val(con.replace(',',""));//内容
                if(me.attr('data')=='0'){
                    $('input[name="publish"]').val('0');//未转交
                }else{
                    $('input[name="publish"]').val('1');//转交
                }
                var fileId="";
                var fileName="";
                for(var i=0;i<$('.inHidden').length;i++){
                    fileId += $('.inHidden').eq(i).val();
                    fileName += $('.inHidden').eq(i).attr('name');
                }
                var imgId="";
                var imgName=""
                for(var i=0;i<$('.imgId').length;i++){
                    imgId += $('.imgId').eq(i).val()+','
                }
                for(var i=0;i<$('.imgName').length;i++){
                    imgName += $('.imgName').val()+'*'
                }
                $('input[name="attachmentId2"]').val(imgId);
                $('input[name="attachmentName2"]').val(imgName);

                $('input[name="managerId"]').val($('#shen').attr('user_id'))//审核人
                $('input[name="managerType"]:checked').val();
                $('input[name="attachmentId"]').val(fileId) //附加id
                $('input[name="attachmentName"]').val(fileName) //附件内容
                // var len=$('.check').length;
                // var str=""
                // for(var i=0;i<len;i++){
                //     if($('.check').eq(i).is(':checked')){
                //         str += $('.check').eq(i).attr('value')+',';
                //     }
                // }
                $('input[name="deliveryDeptId"]').val($('#users').attr('user_id'))
                $('#datasave').ajaxSubmit({
                    type:'post',
                    dataType:'json',
                    data:{id:id},
                    success:function(res){
                        if(res.flag){
                            $.layerMsg({content:'修改成功',icon:1});
                            if(param.read){
                                if(param.is==0){
                                    parent.getPage();
//                                    console.log(parent.document.getElementById('iframe'))
//                                    parent.document.getElementById('iframe').src="/infomation/unread"
                                }else{
                                    parent.getPage1();
//                                    parent.document.getElementById('iframe').src="/infomation/allInfo"
                                }
                            }else{
                                parent.ajaxPageLe.page();
                                $('.iframe',window.parent.document).hide();
                                $('#conList',window.parent.document).show();
                                $('#add',window.parent.document).show();
                            }
                        }
                    }
                })


            }
        })






//        点击选择审核人
        $(".select").on("click", function () {//选人员控件
            user_id = 'shen';
            $.popWindow("../../common/selectUser");
        });
//        清空审核人
        $('.empty').click(function(){
            $('#shen').attr('user_id', '');
            $('#shen').attr('userprivname', '');
            $('#shen').removeAttr('dataid');
            $('#shen').val('');
        })

//        文件上传
        function filesTwo(mes) {
            var arr=mes.files;
            var bool=true;
            for(var i=0;i<arr.length;i++){
                if(arr[i].name.indexOf('.png')==-1&&arr[i].name.indexOf('.jpg')==-1&&arr[i].name.indexOf('.PNG')==-1&&arr[i].name.indexOf('.JPG')==-1){
                    bool=false;
                    break;
                }
            }
            if(!bool){
                $.layerMsg({content:'只能上传.png或.jpg格式！',icon:2});
                return
            }
            $('#datasave').prop('action','/flow/fileUpload?module=infomation_img')

            $('#datasave').ajaxSubmit({
                type:'post',
                dataType:'json',
                success:function (json) {
//                    console.log(json)
                    if(json.flag) {
                        var str='';
                        var arr=json.datas;
                        var attStrId='';
                        var attStrName='';
                        for(var i=0;i<arr.length;i++){

                            attStrId+=arr[i].attStrId+',';
                            attStrName+=arr[i].attStrName+'*';
                            str+='<li>' +
                                '<img src="/xs?'+arr[i].attUrl+'" alt="" onclick="javascript:window.open(this.src)" style="cursor:pointer">' +
                                '<b class="deleClear">x</b>' +
                                '<input type="hidden" class="imgId"  value="'+arr[i].attStrId+'">' +//id
                                '<input type="hidden" class="imgName" value="'+arr[i].attStrName+'">' +//名字
                                '</li>'
                        }
                        $(me).siblings('ul').append(str)
                        $(me).prev('input').val($(me).prev('input').val()+attStrId)
                        $(me).next().val($(me).next().val()+attStrName)
                    }else {
                        alert('异常')
                    }
                }
            })
        }
        $(document).delegate('.deleClear','click',function () {
            var that=$(this);
            that.parents('.picture').find('input[type="hidden"]').eq(0).val("")
            that.parents('.picture').find('input[type="hidden"]').eq(1).val("")
            $(this).parent().remove()
        })
        $('.addPhotos').click(function () {
            me=this;
            $('#picFile').click()
        })
//        附件上传
        $('#uploadimg').click(function(){
            me=this;
            $('#uploadinputimg').click()
        })
        $('#uploadinputimg').fileupload({
            dataType:'json',
            done: function (e, data) {
                if(data.result.obj != ''){
                    var data = data.result.obj;
                    var str = '';
                    var str1 = '';
                    for (var i = 0; i < data.length; i++) {
                        var gs = data[i].attachName.split('.')[1];
                        if(gs == 'jsp'||gs == 'css'||gs == 'js'||gs == 'html'||gs == 'java'||gs == 'php' ){
                            str += '';
                            layer.alert('jsp、css、js、html、java文件禁止上传!',{},function(){
                                layer.closeAll();
                            });
                        }else{
                            str+='<div class="dech" deUrl="'+encodeURI(data[i].attUrl)+'" style="display:block;"><a class="ATTACH_a" NAME="'+data[i].attachName+'*" href="<%=basePath %>download?'+encodeURI(data[i].attUrl)+'">'+data[i].attachName+'</a><img class="deImgs" style="margin-left:5px;cursor: pointer;" src="../img/file/icon_deletecha_03.png"/><input type="hidden" NAME="'+data[i].attachName+'*"  class="inHidden" value="'+data[i].aid+'@'+data[i].ym+'_'+data[i].attachId+',"></div>';
                        }
                    }
                    $('#query_uploadArr').append(str);
                } else{
                    //alert('添加附件大小不能为空!');
                    layer.alert('添加附件大小不能为空!',{},function(){
                        layer.closeAll();
                    });
                }
            }
        });
        $('#query_uploadArr').on('click','.deImgs',function(){
            var data=$(this).parents('.dech').attr('deUrl');
            var dome=$(this).parents('.dech');
            deleteChatment(data,dome);
        });

        //删除附件
        function deleteChatment(data,element){
            layer.confirm('确定要删除吗？', {<%--确定要删除吗--%>
                btn: ['确定','取消'], //按钮  <%--确定 取消--%>
                title:'删除'  <%--删除附件--%>
            }, function(){
                //确定删除，调接口
                $.ajax({
                    type:'get',
                    url:'../delete',
                    dataType:'json',
                    data:data,
                    success:function(res){

                        if(res.flag == true){
                            layer.msg('删除成功', { icon:6});<%--删除成功--%>
                            element.remove();
                        }else{
                            layer.msg('删除失败', { icon:6});<%--删除失败--%>
                        }
                    }
                });

            }, function(){
                layer.closeAll();
            });
        }




    </script>
</body>
</html>
